<?php
use common\components\widgets\Datetimepicker;
Datetimepicker::widget(['timepicker' => 'false','format'=>'Y-m-d']);
?>
<?php $form = \yii\widgets\ActiveForm::begin(['enableAjaxValidation' => true,'enableClientValidation' => false,'options'=>['class'=>'form-validate']]); ?>
    <table width="100%" class="table-form">
        <tr>
            <th class="zx-goods-table"><?= $model->attributeLabels()['status']; ?></th>
            <td style="display: inline-block;width: 206px"><?= $form->field($model, 'status', ['template' => '{input}{error}{hint}'])->widget(\kartik\select2\Select2::className(),['data'=>['5'=>'教师请假', '6'=>'停课', '7'=>'调课'],'options' => ['placeholder' => '请选择']]) ?></td>
        </tr>
        <tr>
            <th class="zx-goods-table"><?= $model->attributeLabels()['remark']; ?></th>
            <td><?= $form->field($model, 'remark', ['template' => '{input}{error}{hint}'])->textarea(['class'=>'input-textarea']) ?></td>
        </tr>
        <tr id="is_delay">
            <th class="zx-goods-table"><?= $model->attributeLabels()['is_delay']; ?></th>
            <td><?= $form->field($model, 'is_delay', ['template' => '{input}{error}{hint}'])->radioList(['0'=>'否', '1'=>'是'],['class'=>'input-text']) ?></td>
        </tr>
        <tr id="change_time" style="display: none">
            <th class="zx-goods-table"><?= $model->attributeLabels()['change_time']; ?></th>
            <td><?= $form->field($model, 'change_time', ['template' => '{input}{error}{hint}'])->textInput(['class'=>'datetimepicker input-text']) ?></td>
        </tr>
    </table>
    <div class="m_top_10 btn" style="display: none">
        <?= \yii\helpers\Html::submitButton('提交', ['class' => "button", 'id' => 'dosubmit']) ?>
    </div>
<?php \yii\widgets\ActiveForm::end(); ?>
<?php
$js =<<<JS
   $(document).on('change','#classlesson-status',function(){
       var status = $(this).val();
       if(status === '7'){
           $('#change_time').css('display','');
           $('#is_delay').css('display','none');
       }else {
           $('#is_delay').css('display','');
           $('#change_time').css('display','none');
       }
   });
JS;
\Yii::$app->view->registerJs($js);
?>
